package com.dropgame.main;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.utils.Json;
import com.badlogic.gdx.utils.Json.Serializable;
import com.badlogic.gdx.utils.OrderedMap;

public class LevelNonSe{

	public int levelID;
	public boolean completed;
	public int lives;
	public int scoreBench;
	public int score1;
	public int score2;
	public int score3;
	public int hiScore;
	public boolean playable;
	
	public char c;
	public String s;
	
	public LevelNonSe(){
		Gdx.app.log("Level", "The default level constructor was called");
	}
	
	// Constructor which takes an int which is converted to a string
	// And used in reading and writing the profiles.
	public LevelNonSe(int level){
		s = Integer.toString(level);
		c = (char) level;
		Gdx.app.log("LevelNonSe", "level" + s + "ID");
	}
	
	
	
	public void read(Json json, OrderedMap<String, Object> jsonData) {
		levelID = json.readValue("level" + s + "ID", Integer.class, jsonData);
		//completed = json.readValue("level" + s + "Completed", Boolean.class, jsonData);
		lives = json.readValue("level" + s + "Lives", Integer.class, jsonData);
		scoreBench = json.readValue("level" + s + "Benchmark", Integer.class, jsonData);
		score1 = json.readValue("level" + s + "Score1", Integer.class, jsonData);
		score2 = json.readValue("level" + s + "Score2", Integer.class, jsonData);
		score3 = json.readValue("level" + s + "Score3", Integer.class, jsonData);
		playable = json.readValue("level" + s + "Playable", Boolean.class, jsonData);
		
		
	}
	
	
	public void write(Json json) {
		json.writeValue("level" + s + "ID", levelID);
		//json.writeValue("level" + s + "Completed", completed);
		json.writeValue("level" + s + "Lives", lives);
		json.writeValue("level" + s + "Benchmark", scoreBench);
		json.writeValue("level" + s + "Score1", score1);
		json.writeValue("level" + s + "Score2", score2);
		json.writeValue("level" + s + "Score3", score3);
		json.writeValue("level" + s + "Playable", playable);
		
	}
	
}
